package cn.wolfcode.crm.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
public class CustomerTraceHistory {

    private Long id;

    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date traceTime;
    private String traceDetail;//跟进内容
    private SystemDictionaryItem traceType;//跟进类型
    private SystemDictionaryItem traceResult;//跟进结果
    private String remark;//备注
    private Customer customer;//客户id
    private Employee inputUser;//录入人id
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date inputTime;//录入时间

    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",this.id);
        map.put("traceTime",this.traceTime);
        map.put("traceDetail",this.traceDetail);
        map.put("traceTypeId",this.traceType.getId());
        map.put("traceResultId",this.traceResult.getId());
        map.put("remark",this.remark);
        map.put("customer",this.customer.getId());
        map.put("inputUser",this.inputUser.getId());
        return JSON.toJSONString(map);
    }
}